package com.zoo.wuhua.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zoo.wuhua.entity.FastjsonBook;
import com.zoo.wuhua.entity.GsonBook;
import com.zoo.wuhua.entity.JacksonBook;

/**
 * <b>jackson、gson、fastjson三种json解析示例</b><br>
 *
 * @author zhangli7@yusys.com.cn
 * @since 2019年10月24日 下午7:56:28
 */
@RestController
@RequestMapping("/json")
public class JsonController {

	@Autowired
	private JacksonBook jacksonBook;

	@Autowired
	private GsonBook gsonBook;

	@Autowired
	private FastjsonBook fastjsonBook;

	@RequestMapping("/jackson")
	public JacksonBook jackson() {
		jacksonBook.setPublicDate(new Date());
		return jacksonBook;
	}

	@RequestMapping("/gson")
	public GsonBook gson() {
		gsonBook.setPublicDate(new Date());
		return gsonBook;
	}

	@RequestMapping("/fastjson")
	public FastjsonBook fastjson() {
		fastjsonBook.setPublicDate(new Date());
		return fastjsonBook;
	}
}
